<template>
	<ResourcePage ref="refPageController" page-name="报警日志" scene="alarm" @get:list="getTableData">
		<template #columns>
			<el-table-column prop="event_name" label="事件名称" align="center" />
			<el-table-column prop="event_type_name" label="事件类型" align="center" />
			<el-table-column prop="event_level_name" label="警情级别" align="center" />
			<el-table-column prop="event_time" label="发生时间" align="center">
				<template #default="{ row }">
					<span style="font-size:13px;">{{ row.event_time }}</span>
				</template>
			</el-table-column>
			<el-table-column prop="status_name" label="事件状态" align="center" />
			<el-table-column prop="handle_result" label="处理结果" align="center" />
			<el-table-column prop="username" label="处理用户" align="center" />
			<el-table-column prop="handle_time" label="处理时间" align="center" />
			<el-table-column prop="device_name" label="告警源" align="center" />
			<el-table-column prop="dvc_installation" label="告警源位置" align="center" />
			<el-table-column prop="event_desc" label="事件描述" align="center" />
		</template>
	</ResourcePage>
</template>

<script setup>
import { ref } from 'vue'
import { fetchEventBasic } from '@/api/event.services'
import ResourcePage from '../components/ResourcePage.vue'

const refPageController = ref(null)

const getTableData = async (data, { resolve }) => {
	const postData = {
		username: data.username,
		event_time: data.event_time,
		page: data.page,
		limit: data.limit
	}
	const result = await fetchEventBasic(postData)
	if (result.code == 1) {
		resolve({
			list: result.data.data,
			total: result.data.total
		})
	}
}
</script>
